package com.learn.elasticsearch.annotation;


import org.springframework.core.annotation.AliasFor;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.IndexOptions;
import org.springframework.data.elasticsearch.annotations.IndexPrefixes;
import org.springframework.data.elasticsearch.annotations.Similarity;
import org.springframework.data.elasticsearch.annotations.TermVector;

import java.lang.annotation.*;

/**
 * @description: java类作用描述
 * @author: MI
 * @email: 448341911@qq.com
 * @createTime: 2024/1/15 16:00
 * @updateUser: MI
 * @updateTime: 2024/1/15 16:00
 * @updateRemark: 修改内容
 * @version: v1.0
 */
@Documented
@Target({ElementType.FIELD})
@Inherited
@Retention(RetentionPolicy.RUNTIME)
public @interface ESField {

    /**
     * 属性别名
     *
     * @return
     */
    @AliasFor("name")
    String value() default "";

    /**
     * 属性别名
     *
     * @return
     */
    @AliasFor("value")
    String name() default "";

    FieldType type() default FieldType.Auto;

    boolean index() default true; //默认情况下分词

    DateFormat format() default DateFormat.none; //时间格式化

    String pattern() default "";

    boolean store() default false; //默认情况下不存储原文

    String searchAnalyzer() default ""; //指定字段搜索时使用的分词器

    String indexAnalyzer() default "";//指定字段建立索引时指定的分词器

    String[] ignoreFields() default {};//忽略某些字段


    boolean includeInParent() default false;

    String[] copyTo() default {};

    int ignoreAbove() default -1;

    boolean coerce() default true;

    boolean docValues() default true;

    boolean ignoreMalformed() default false;

    IndexOptions indexOptions() default IndexOptions.none;

    boolean indexPhrases() default false;

    IndexPrefixes[] indexPrefixes() default {};

    boolean norms() default true;

    String nullValue() default "";

    int positionIncrementGap() default -1;

    Similarity similarity() default Similarity.Default;

    TermVector termVector() default TermVector.none;

    double scalingFactor() default 1;

    int maxShingleSize() default -1;
}
